package com.ruoyi.fly.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.fly.domain.AppletMember;
import com.ruoyi.fly.domain.vo.AppletMemberVo;
import com.ruoyi.fly.mapper.AppletMemberMapper;
import com.ruoyi.fly.service.AppletMemberService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 商城会员信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-08
 */
@Service
public class AppletMemberServiceImpl implements AppletMemberService {
    @Autowired
    private AppletMemberMapper appletMemberMapper;

    /**
     * 查询商城会员信息
     *
     * @param id 商城会员信息主键
     * @return 商城会员信息
     */
    @Override
    public AppletMember selectAppletMemberById(String id) {
        return appletMemberMapper.selectAppletMemberById(id);
    }

    /**
     * 查询商城会员信息列表
     *
     * @param appletMember 商城会员信息
     * @return 商城会员信息
     */
    @Override
    public List<AppletMember> selectAppletMemberList(AppletMember appletMember) {
        return appletMemberMapper.selectAppletMemberList(appletMember);
    }

//    /**
//     * 新增商城会员信息
//     *
//     * @param appletMember 商城会员信息
//     * @return 结果
//     */
//    @Override
//    public int insertAppletMember(AppletMember appletMember)
//    {
//        appletMember.setCreateTime(DateUtils.getNowDate());
//        return appletMemberMapper.insertAppletMember(appletMember);
//    }

    /**
     * 修改商城会员信息
     *
     * @param appletMember 商城会员信息
     * @return 结果
     */
    @Override
    public R updateAppletMember(AppletMemberVo appletMember) {
        appletMember.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
        appletMember.setUpdateTime(DateUtils.getNowDate());
        return appletMemberMapper.updateAppletMember(appletMember)>0?R.ok("修改成功"):R.fail("操作失败");
    }

    /**
     * 删除商城会员信息信息
     *
     * @param id 商城会员信息主键
     * @return 结果
     */
    @Override
    public R deleteAppletMemberById(String id) {
        return appletMemberMapper.deleteAppletMemberById(id)>0?R.ok("删除成功"):R.fail("操作失败");
    }

    @Override
    public R deleteAppletMemberByIds(List<String> ids) {
        return appletMemberMapper.deleteAppletMemberByIds(ids)>0?R.ok("删除成功"):R.fail("操作失败");
    }
}
